// 通用大小
$size-base: 4px;
$size-1: $size-base;
$size-2: $size-base * 2;
$size-3: $size-base * 3;
$size-4: $size-base * 4;
$size-5: $size-base * 5;

// 普通文本 font-size
$font-size-base: 18px;
$font-size-lg: $font-size-base + 6px;
$font-size-md: $font-size-base + 4px;
$font-size-sm: $font-size-base + 2px;
$font-size-xs: $font-size-base;

// 标题文本 font-size
$font-size-heading-1: ceil($font-size-base * 2.71);
$font-size-heading-2: ceil($font-size-base * 2.14);
$font-size-heading-3: ceil($font-size-base * 1.71);
$font-size-heading-4: ceil($font-size-base * 1.42);
$font-size-heading-5: ceil($font-size-base * 1.14);
$font-size-heading-6: ceil($font-size-base * 1);

// 通用行高 line-height
$line-height-base: 1;
$line-height-lg: $line-height-base * 2;
$line-height-md: $line-height-base * 1.7;
$line-height-sm: $line-height-base * 1.5;
$line-height-xs: $line-height-base * 1.1;

// margin 和 padding
$margin-padding-lg: 32px;
$margin-padding-md: 24px;
$margin-padding-sm: 16px;
$margin-padding-xs: 8px;
$margin-padding-inline: 6px;

// 代码 font-family
$font-family-monospace: Menlo, Monaco, Consolas, 'Courier New', monospace;

// color
$color-black: rgb(0, 0, 0);
$color-white: rgb(255, 255, 255);

//$color-text-1: rgb(255, 255, 255);
//$color-text-1: rgb(33, 33, 34);
$color-text-2: rgb(119, 119, 119);
$color-text-3: rgb(160, 160, 160);
$color-text-4: rgb(190, 190, 190);
$color-text-5: rgb(255, 255, 255);

//$color-border-1: rgb(255, 255, 255);
$color-border-1: rgb(33, 33, 34);
$color-border-2: rgb(198, 196, 196);
$color-border-3: rgb(221, 221, 221);
$color-border-4: rgb(246, 246, 246);

//$color-background-1: rgb(255, 255, 255);
$color-background-1: rgb(33, 33, 34);
$color-background-2: rgba(0, 0, 0, 0);
$color-background-3: rgb(251, 251, 251);

$color-emphasize-base: rgb(239, 112, 96);

// transtion
$transtion-1: all 0.3s ease-out;

$line-space: 22px;

.markdown-body-geek-black {
  word-break: break-word;
  line-height: $line-height-md;
  font-weight: 400;
  font-size: $font-size-sm;
  overflow-x: hidden;
  //color: $color-text-1;

  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    line-height: $line-height-sm;
    margin-bottom: $margin-padding-xs;
    padding-bottom: $margin-padding-xs;
  }

  h1 {
    color: $color-text-3;
    font-size: $font-size-heading-1;
    margin-top: $margin-padding-lg;
    padding-top: $margin-padding-lg;
  }

  h2 {
    color: $color-text-5;
    background-color: $color-background-1;
    width: fit-content;
    border-bottom-right-radius: 100px;
    margin-top: $margin-padding-lg + 15px;
    padding-top: $margin-padding-xs * 0.5;
    margin-bottom: $margin-padding-sm;
    padding-bottom: $margin-padding-xs * 0.5;
    padding-right: $margin-padding-lg + $size-4;
    padding-left: $margin-padding-xs;
    line-height: $line-height-md;
    font-size: $font-size-heading-2;
    transition: $transtion-1;

    &:hover {
      border-bottom-right-radius: 50px;
      transition: $transtion-1;
    }
  }

  h3 {
    font-size: $font-size-heading-3;
    padding-left: $margin-padding-xs;
    margin-top: $margin-padding-lg;
    border-bottom: 2px solid $color-border-2;
    line-height: $line-height-md;
  }

  h4 {
    font-size: $font-size-heading-4;
    padding-left: $margin-padding-xs;
    margin-top: $margin-padding-lg;
    border-bottom: 1px solid $color-border-3;
  }

  h5 {
    font-size: $font-size-heading-5;
    margin-top: $margin-padding-md;
  }

  h6 {
    margin-top: $font-size-heading-6;
    margin-top: $margin-padding-sm;
    line-height: $line-height-xs;
  }

  p {
    font-size: $font-size-sm;
    text-align: start;
    white-space: normal;
    text-size-adjust: auto;
    line-height: $line-height-lg;
    margin-top: $margin-padding-sm;
    margin-bottom: $margin-padding-sm;
    color: #38b48b;
  }

  img {
    max-width: 100%;
    margin: auto;
    padding-left: $margin-padding-xs;
    padding-right: $margin-padding-xs;
  }

  hr {
    border-top: 4px double $color-border-1;
    border-bottom: none;
    border-left: none;
    border-right: none;
    margin-top: $margin-padding-lg;
    margin-bottom: $margin-padding-lg;
    text-align: center;
  }

  hr:after {
    content: '\002665';
    display: inline-block;
    position: relative;
    top: -15px;
    padding: 0 10px;
    color: $color-border-1;
    font-size: 18px;
  }

  code {
    font-family: $font-family-monospace;
    word-break: break-word;
    border-radius: 2px;
    overflow-x: auto;
    background-color: $color-background-2;
    color: $color-emphasize-base;
    font-size: $font-size-xs;
    padding: 0.065em $margin-padding-inline;
  }

  pre {
    font-family: $font-family-monospace;
    overflow: auto;
    position: relative;
    line-height: $line-height-md;
    box-shadow: 0 0 8px rgba(110, 110, 110, 0.45);
    border-radius: 2px;
    margin: $margin-padding-lg $margin-padding-sm;

    &:before {
      content: '';
      display: block;
      height: 30px;
      width: 100%;
      background: url()
        10px 10px no-repeat;
      background-color: $color-background-1;
      box-shadow: 0 0 8px rgba(110, 110, 110, 0.45);
      background-size: 40px;
    }

    > code {
      font-size: $font-size-xs;
      padding: $margin-padding-sm $margin-padding-xs;
      margin: 0;
      word-break: normal;
      display: block;
      overflow-x: auto;
      color: $color-text-5;
      background: #1e1e1e;

      &::-webkit-scrollbar {
        height: 10px;
        background-color: #f5f5f5;
      }

      &::-webkit-scrollbar-track {
        box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
        border-radius: 3px;
        background-color: #f5f5f5;
      }

      &::-webkit-scrollbar-thumb {
        border-radius: 3px;
        box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
        background-color: #555;
      }
    }
  }

  a {
    color: $color-emphasize-base;
    padding: 2px 2px;
    text-decoration: none;
    border-bottom: 0.125em solid $color-emphasize-base;
    border-radius: 2px;
    box-shadow: inset 0 -0.025em 0 $color-emphasize-base;
    transition: box-shadow 270ms cubic-bezier(0.77, 0, 0.175, 1),
      color 270ms cubic-bezier(0.77, 0, 0.175, 1);

    &:focus,
    &:hover {
      outline: none;
      box-shadow: inset 0 -1.5em 0 $color-emphasize-base;
      color: $color-text-5;
    }

    &::before {
      content: '⇲ ';
      vertical-align: top;
      margin-left: 2px;
      font-family: 'dart' !important;
      font-size: 12px;
      color: inherit;
      opacity: 0.7;
    }
  }

  table {
    background: $color-background-3;
    border-radius: $size-1;
    border-collapse: collapse;
    margin: auto;
    padding: 5px;
    width: 95%;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
    animation: float 5s infinite;

    th {
      color: $color-text-5;
      background: $color-background-1;
      border-bottom: 1px solid #9ea7af;
      border-right: 1px solid #343a45;
      font-size: $font-size-md;
      padding: $margin-padding-sm;
      text-align: left;
      vertical-align: middle;
    }

    th:first-child {
      border-top-left-radius: 4px;
    }

    th:last-child {
      border-top-right-radius: 4px;
      border-right: none;
    }

    tr {
      border-top: 1px solid #c1c3d1;
      border-bottom: 1px solid #c1c3d1;
      color: #666b85;
    }

    tr:hover td {
      background: $color-background-1;
      color: $color-text-5;
      border-top: 1px solid #22262e;
    }

    tr:first-child {
      border-top: none;
    }

    tr:last-child {
      border-bottom: none;
    }

    tr:nth-child(odd) td {
      background: $color-background-2;
    }

    tr:nth-child(odd):hover td {
      background: $color-background-1;
    }

    tr:last-child td:first-child {
      border-bottom-left-radius: 4px;
    }

    tr:last-child td:last-child {
      border-bottom-right-radius: 4px;
    }

    td {
      background: $color-background-3;
      padding: $margin-padding-sm;
      text-align: left;
      vertical-align: middle;
      font-size: $font-size-sm;
      border-right: 1px solid #c1c3d1;
    }

    td:last-child {
      border-right: 0px;
    }
  }

  blockquote {
    color: $color-text-2;
    padding: 1px $margin-padding-sm;
    margin: $margin-padding-md 0;
    border-left: 4px solid $color-border-2;
    background-color: $color-background-2;
    transition: $transtion-1;
    border-radius: $size-1;

    &:hover {
      border-left-color: $color-border-1;
      background-color: $color-background-1;
      color: $color-text-5;
    }

    &::after {
      display: block;
      content: '';
    }

    & > p {
      margin: 10px 0;
    }
  }

  ol,
  ul {
    padding-left: $margin-padding-md;

    li {
      margin-bottom: $margin-padding-inline;
      list-style: inherit;

      & .task-list-item {
        list-style: none;

        ul,
        ol {
          margin-top: 0;
        }
      }
    }

    ul,
    ol {
      margin-top: 3px;
    }
  }

  ol li {
    padding-left: 6px;
  }

  span.math {
    margin-left: $margin-padding-lg;
    font-size: $font-size-md;
    font-weight: bold;
  }

  @media (max-width: 720px) {
    h1 {
      font-size: $font-size-heading-1 * 0.8;
    }
    h2 {
      font-size: $font-size-heading-2 * 0.8;
    }
    h3 {
      font-size: $font-size-heading-3 * 0.8;
    }
    h4 {
      font-size: $font-size-heading-4 * 0.8;
    }
    h5 {
      font-size: $font-size-heading-5 * 0.8;
    }
  }
}
